sizegroup: Refactor function
authorBenjamin Otte <otte@redhat.com>
Fri, 18 Sep 2015 01:49:09 +0000 (03:49 +0200)
committerBenjamin Otte <otte@redhat.com>
Wed, 28 Oct 2015 18:44:27 +0000 (19:44 +0100)
Get rid of continues in loop. This allows doing more complex things in
future commits.

gtk/gtksizegroup.c

index 091bcc9097b1b1e20b5e2bcc84adc5c0812f64d3..d6276a90f5a5d6b5f68b9cd53af78be93bd0e8cc 100644 (file)
@@ -239,43 +239,36 @@ queue_resize_on_widget (GtkWidget *widget,
 
   while (parent)
     {
-      GSList *widget_groups;
-      GHashTableIter iter;
-      gpointer current;
-      
       if (widget == parent)
         real_queue_resize (widget);
 
-      if (widget == parent && !check_siblings)
+      if (!check_siblings || _gtk_widget_get_sizegroups (parent) == NULL)
        {
-          parent = _gtk_widget_get_parent (parent);
-         continue;
+          check_siblings = TRUE;
        }
-
-      widget_groups = _gtk_widget_get_sizegroups (parent);
-      if (!widget_groups)
-       {
-          parent = _gtk_widget_get_parent (parent);
-         continue;
-       }
-
-      g_hash_table_remove_all (widgets);
-      g_hash_table_remove_all (groups);
-      add_widget_to_closure (widgets, groups, parent, -1);
-
-      g_hash_table_iter_init (&iter, widgets);
-      while (g_hash_table_iter_next (&iter, &current, NULL))
-       {
-         if (current == parent)
-           {
-              /* do nothing */
-           }
-         else if (current == widget)
+      else
+        {
+          GHashTableIter iter;
+          gpointer current;
+          
+          g_hash_table_remove_all (widgets);
+          g_hash_table_remove_all (groups);
+          add_widget_to_closure (widgets, groups, parent, -1);
+
+          g_hash_table_iter_init (&iter, widgets);
+          while (g_hash_table_iter_next (&iter, &current, NULL))
             {
-              g_warning ("A container and its child are part of this SizeGroup");
+              if (current == parent)
+                {
+                  /* do nothing */
+                }
+              else if (current == widget)
+                {
+                  g_warning ("A container and its child are part of this SizeGroup");
+                }
+              else
+                queue_resize_on_widget (current, FALSE);
             }
-         else
-           queue_resize_on_widget (current, FALSE);
        }
 
       parent = _gtk_widget_get_parent (parent);